package collection;

import java.util.HashMap;
import java.util.Map;

/**
 * Map常用方法
 */
public class TestMap02 {
    public static void main(String[] args) {
        Employee el = new Employee(1,"张哲",50000);
        Employee e2 = new Employee(2,"狗瑶",60000);
        Employee e3 = new Employee(3,"兔兔",70000);

        Map<Integer,Employee> map = new HashMap<>();

        map.put(el.getId(),el);
        System.out.println(map);
    }
}

//雇员信息
class Employee{
    private int id;
    private String name;
    private double salary;

    public Employee(int id, String name, double salary) {
        this.id = id;
        this.name = name;
        this.salary = salary;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    @Override
    public String toString() {
        return "id"+id+"姓名"+name+"薪资"+salary;
    }
}
